import json

import yaml
class FileParse:
    @staticmethod
    def parse_json_data(jsonfile):
        # with open(jsonfile,'r',encoding='UTF-8') as f:
        #     data = json.load(f)
        #     return data

        try:
            with open(jsonfile, 'r', encoding='UTF-8') as f:
                return json.load(f)
        except FileNotFoundError as e:
            print(f"错误：文件 {jsonfile} 未找到，请检查其位置。")
            # return []  # 或者根据具体使用情况返回其他合适的默认值

    @staticmethod
    def parse_yaml_data(yamlfile):
        with open(yamlfile,'r',encoding='UTF-8') as f:
            data = yaml.safe_load(f)
            return data